package com.smart.service.impl;

import com.smart.entity.SysOperationLog;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.smart.service.SysOperationLogService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * @author lgb
 * @date 2020年6月22日 下午3:40:19
 * Copyright (C) 深圳工勘科技
 * @说明: 
 **/
@Service
public class SysOperationLogServiceImpl extends BaseServiceImpl<SysOperationLog,Integer>
        implements SysOperationLogService{

	@Override
	public IPage<SysOperationLog> findPage(Integer operatorType,String operName,
		String createTime_start,String createTime_end, Integer pageNum,Integer pageSize){
		QueryWrapper<SysOperationLog> wrapper = new QueryWrapper<>();
		if(operatorType != null){
			wrapper.eq("operator_type",operatorType);
		}
		if(StringUtils.isNotEmpty(operName)){
			wrapper.like("oper_name",operName);
		}
		if(StringUtils.isNotEmpty(createTime_start)){
			wrapper.gt("create_time",createTime_start+" 00:00:00");
		}
		if(StringUtils.isNotEmpty(createTime_end)){
			wrapper.le("create_time",createTime_end+" 23:59:59");
		}
		wrapper.orderByDesc("create_time");
		return super.page(new Page<>(pageNum,pageSize),wrapper);
	}

	
}